package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.BaseTabbar;
import com.ruoyi.system.service.IBaseTabbarService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 标签栏管理Controller
 * 
 * @author linziheng
 * @date 2025-06-13
 */
@RestController
@RequestMapping("/system/tabbar")
public class BaseTabbarController extends BaseController
{
    @Autowired
    private IBaseTabbarService baseTabbarService;

    /**
     * 查询标签栏管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:tabbar:list')")
    @GetMapping("/list")
    public TableDataInfo list(BaseTabbar baseTabbar)
    {
        startPage();
        List<BaseTabbar> list = baseTabbarService.selectBaseTabbarList(baseTabbar);
        return getDataTable(list);
    }

    /**
     * 导出标签栏管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:tabbar:export')")
    @Log(title = "标签栏管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BaseTabbar baseTabbar)
    {
        List<BaseTabbar> list = baseTabbarService.selectBaseTabbarList(baseTabbar);
        ExcelUtil<BaseTabbar> util = new ExcelUtil<BaseTabbar>(BaseTabbar.class);
        util.exportExcel(response, list, "标签栏管理数据");
    }

    /**
     * 获取标签栏管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:tabbar:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(baseTabbarService.selectBaseTabbarById(id));
    }

    /**
     * 新增标签栏管理
     */
    @PreAuthorize("@ss.hasPermi('system:tabbar:add')")
    @Log(title = "标签栏管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BaseTabbar baseTabbar)
    {
        return toAjax(baseTabbarService.insertBaseTabbar(baseTabbar));
    }

    /**
     * 修改标签栏管理
     */
    @PreAuthorize("@ss.hasPermi('system:tabbar:edit')")
    @Log(title = "标签栏管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BaseTabbar baseTabbar)
    {
        return toAjax(baseTabbarService.updateBaseTabbar(baseTabbar));
    }

    /**
     * 删除标签栏管理
     */
    @PreAuthorize("@ss.hasPermi('system:tabbar:remove')")
    @Log(title = "标签栏管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(baseTabbarService.deleteBaseTabbarByIds(ids));
    }
}
